package de.g18.gruppe3.common.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

public abstract class AbstractModel {

    private PropertyChangeSupport changeSupport;


    protected AbstractModel() {
        changeSupport = new PropertyChangeSupport(this);
    }

    /**
     * @see PropertyChangeSupport#firePropertyChange(String, boolean, boolean)
     */
    protected void firePropertyChange(String aPropertyName, boolean aOldValue, boolean aNewValue) {
        changeSupport.firePropertyChange(aPropertyName, aOldValue, aNewValue);
    }

    /**
     * @see PropertyChangeSupport#firePropertyChange(String, int, int)
     */
    protected void firePropertyChange(String aPropertyName, int aOldValue, int aNewValue) {
        changeSupport.firePropertyChange(aPropertyName, aOldValue, aNewValue);
    }

    /**
     * @see PropertyChangeSupport#firePropertyChange(String, Object, Object)
     */
    protected void firePropertyChange(String aPropertyName, Object aOldValue, Object aNewValue) {
        changeSupport.firePropertyChange(aPropertyName, aOldValue, aNewValue);
    }

    /**
     * @see PropertyChangeSupport#addPropertyChangeListener(PropertyChangeListener)
     */
    public void addPropertyChangeListener(PropertyChangeListener aListener) {
        changeSupport.addPropertyChangeListener(aListener);
    }

    /**
     * @see PropertyChangeSupport#addPropertyChangeListener(String, PropertyChangeListener)
     */
    public void addPropertyChangeListener(String aPropertyName, PropertyChangeListener aListener) {
        changeSupport.addPropertyChangeListener(aPropertyName, aListener);
    }
}
